<%@ page language="java" pageEncoding="utf-8"%>
<%@page import="com.farm.web.constant.FarmConstant"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="/view/conf/farmtag.tld" prefix="PF"%>
<c:forEach items="${forms }" var="node">
	<c:if test="${node.model=='select' }">
		<div class="form-group">
			<label for="${node.code}_id">${node.name}(${node.code}) 
				<c:if test="${!empty node.pcontent}">
					<i class="glyphicon glyphicon-question-sign" data-toggle="popover"
						data-content="${node.pcontent}"></i>
				</c:if>
			</label> <select onload="selectOnLoad(this)"
				class="form-control form-select-init" name="${node.code}"
				id="${node.code}_id" val="${attrs[node.code]}">
				<PF:OptionDictionary index="${node.enums}" isTextValue="0" />
			</select>
		</div>
	</c:if>
	<c:if test="${node.model=='textarea' }">
		<div class="form-group">
			<label for="${node.code}_id">${node.name}(${node.code})
				<c:if test="${!empty node.pcontent}">
					<i class="glyphicon glyphicon-question-sign" data-toggle="popover"
						data-content="${node.pcontent}"></i>
				</c:if>
			</label>
			<textarea class="form-control" id="${node.code}_id"
				name="${node.code}" placeholder="${node.pcontent}" rows="3">${attrs[node.code]}</textarea>
		</div>
	</c:if>
	<c:if test="${node.model=='text' }">
		<div class="form-group">
			<label for="${node.code}_id">${node.name}(${node.code}) 
				<c:if test="${!empty node.pcontent}">
					<i class="glyphicon glyphicon-question-sign" data-toggle="popover"
						data-content="${node.pcontent}"></i>
				</c:if>
			</label> 
			<input type="text" name="${node.code}" value="${attrs[node.code]}"
				class="form-control" id="${node.code}_id"
				placeholder="${node.pcontent}">
		</div>
	</c:if>
</c:forEach>
<button onclick="submitParas()" class="btn btn-success btn-lg">提交</button>
<script type="text/javascript">
	$(function() {
		$('.form-select-init').each(function(i, obj) {
			$('option', obj).each(function(index, val) {
				if ($(val).attr('value') == $(obj).attr("val")) {
					$(val).attr('selected', true);
				}
			});
		});
		$('[data-toggle="popover"]').popover();
	});
</script>
<style>
.form-group i {
	cursor: pointer;
	color: #c99364;
}
</style>